package tech.daoxuan.signlogin.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.daoxuan.signlogin.entity.DataResp;
import tech.daoxuan.signlogin.entity.User;
import tech.daoxuan.signlogin.service.UserService;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author daoxuan
 * @Date 2019/4/29 12:43
 * @Version 1.0
 */
@RestController("/userface")
public class UserController {

    @Autowired
    private UserService userService;
    /**
     * 注册
     * @param user
     * @return
     */
    @PostMapping("/register")
    public DataResp register(User user) {
        return userService.register(user);
    }

    /**
     * 登陆
     * @param user
     * @param passwordLogin
     * @return
     */
    @PostMapping("/login")
    public DataResp login(User user, boolean passwordLogin) {
        return userService.login(user, passwordLogin);
    }

    @PostMapping("/aliveCheck")
    public DataResp aliveCheck(String imgBase64, String checkType, String userId) {
        return userService.aliveCheck(imgBase64, checkType, userId);
    }
}
